//
//  UIButton + Extension.swift
//  GHWeibo
//
//  Created by LGH on 2017/8/6.
//  Copyright © 2017年 LGH. All rights reserved.
//

import UIKit

extension UIButton {
    
    class func buttonWith(title: String, fontSize: CGFloat, normalColor: UIColor, highlightedColor: UIColor, imageName: String, target: Any?, action: Selector) -> UIButton {
        
        let btn = UIButton()
        btn.setTitle(title, for: .normal)
        btn.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        btn.setBackgroundImage(UIImage(named: imageName), for: .normal)
        btn.setTitleColor(normalColor, for: .normal)
        btn.setTitleColor(highlightedColor, for: .highlighted)
        btn.addTarget(target, action: action, for: .touchUpInside)
        btn.sizeToFit()
        
        return btn
    }
}
